home *** CD-ROM | disk | FTP | other *** search
/ Champak 29 / Volume 29 - JOGO DISK .iso / Games / jungle_adventure.swf / scripts / __Packages / VR_HiddenPlatform.as < prev    next >
Text File  |  2006-11-29  |  3KB  |  95 lines

  1. class VR_HiddenPlatform extends GameCollectable
  2. {
  3.    var assetID = "PlatformToken";
  4.    var collected = false;
  5.    var totalTime = 20;
  6.    var editor_isItem = true;
  7.    var editor_name = "VRHiddenPlatform";
  8.    var editor_args_names = ["totalTime"];
  9.    var editor_args_values = [VR_HiddenPlatform.prototype.totalTime];
  10.    var editor_args_types = ["number"];
  11.    var editor_args_options = [[10,60,5]];
  12.    var editor_args_descriptions = [""];
  13.    var editor_args_mode = [0];
  14.    var editor_args_component = ["NumericStepper"];
  15.    function VR_HiddenPlatform(time)
  16.    {
  17.       super();
  18.       if(time != null)
  19.       {
  20.          this.totalTime = time;
  21.       }
  22.    }
  23.    function onAddToWorld()
  24.    {
  25.       if(!_global.VR_ON_PLATFORMS)
  26.       {
  27.          this.world.removeObject(this);
  28.          return undefined;
  29.       }
  30.       this.world.addToCollection("platforms",this);
  31.    }
  32.    function onAddDisplay()
  33.    {
  34.       if(this.collected)
  35.       {
  36.          this.target._visible = false;
  37.       }
  38.    }
  39.    function reset()
  40.    {
  41.       this.collected = false;
  42.       if(this.inScene)
  43.       {
  44.          this.target._visible = true;
  45.       }
  46.    }
  47.    function setCollected(obj)
  48.    {
  49.       if(this.collected)
  50.       {
  51.          return undefined;
  52.       }
  53.       if(!VR_HiddenPlatform.activeObj)
  54.       {
  55.          VR_HiddenPlatform.activeObj = this;
  56.          this.getUpdates();
  57.          var _loc3_ = undefined;
  58.          var _loc2_ = _loc3_ = this.world.collections.VR.length;
  59.          while((_loc2_ = _loc2_ - 1) > -1)
  60.          {
  61.             _loc3_[_loc2_].disabled = false;
  62.             _loc3_[_loc2_].target._visible = true;
  63.          }
  64.       }
  65.       this.target._visible = false;
  66.       this.collected = true;
  67.       VR_HiddenPlatform.activeTime = this.totalTime;
  68.       GameSound.playSound("vr");
  69.       this.keepInScene = true;
  70.       this.getUpdates();
  71.    }
  72.    function update(elapsed)
  73.    {
  74.       VR_HiddenPlatform.activeTime = Math.max(VR_HiddenPlatform.activeTime - elapsed,0);
  75.       if(!VR_HiddenPlatform.activeTime)
  76.       {
  77.          this.cancelUpdates();
  78.          VR_HiddenPlatform.activeObj = null;
  79.          this.keepInScene = false;
  80.          var _loc3_ = undefined;
  81.          var _loc2_ = _loc3_ = this.world.collections.VR.length;
  82.          while((_loc2_ = _loc2_ - 1) > -1)
  83.          {
  84.             _loc3_[_loc2_].disabled = true;
  85.             _loc3_[_loc2_].target._visible = false;
  86.          }
  87.          _loc2_ = _loc3_ = this.world.collections.platforms.length;
  88.          while((_loc2_ = _loc2_ - 1) > -1)
  89.          {
  90.             _loc3_[_loc2_].reset();
  91.          }
  92.       }
  93.    }
  94. }
  95.